#include "../../client/rpc_client.hpp"
#include <iostream>       // std::cout, std::endl
#include <thread>         // std::this_thread::sleep_for
#include <chrono>         // std::chrono::seconds

void cb(const std::string& topic, const std::string& msg)
{
    INFO_LOG("%s 信息到来，内容是%s！", topic.c_str(), msg.c_str());
}
int main()
{
    //实例化发布客服端
    RPC::Client::TopicClient subscribe_client("127.0.0.1", 9000);
    bool ret = subscribe_client.topicCreate("news");
    if(ret == false) 
    {
        ERROR_LOG("主题创建失败！");
        return 1;
    }
    subscribe_client.topicSubscribe("news", cb);
    std::this_thread::sleep_for(std::chrono::seconds(100));
    subscribe_client.shutdown();
    return 0;
}